package com.rd.student.ruanjian.class4.lichunquan.Text04;

import java.util.Arrays;
import java.util.Scanner;

public class Demo01 {
    public static void main(String[] args) {
        test02();
    }
    public static void test01(){
        int[] arr = {1,3,5,7,9,11,13,15,17,0};//10
        Scanner sc = new Scanner(System.in);
        System.out.println("输入数字");
        int number = sc.nextInt();

        for (int i = 0; i < arr.length-1; i++) {
            if(arr[i] >= number){
                System.arraycopy(arr, i,arr,i+1,arr.length-i-1);
                arr[i] = number ;
                break;
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    public static void test02() {
        int[] arr = {1,3,5,7,9,11,13,15,17,0};//10
        Scanner sc = new Scanner(System.in);
        System.out.println("输入数字");
        int number = sc.nextInt();
        for (int i = 0; i < arr.length-1; i++) {
            if(arr[i] == number){
                System.arraycopy(arr, i+1,arr,i,arr.length-i-1);
                arr[arr.length-1] = 0 ;
                break;
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    public static void test03() {
        int[] arr = {1,3,5,7,9,11,13,15,17,19};//10
        int sum = 0;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < arr.length-1; i++) {
           sum = sum+arr[i];
           if(max<arr[i])
               max = arr[i];
           if(min>arr[i])
               min = arr[i];

        }
        System.out.println(sum);
        System.out.println(sum/arr.length);
    }
}
